import 'package:flutter/material.dart';
import 'package:flutter_widget/src/config/assets.dart';
import 'package:flutter_widget/src/config/color_define.dart';

/*空白页面*/
class EmptyWidget extends StatelessWidget {
  final String? icon;
  final String? text;
  final double? textFontSize;
  final Widget? bottomWidget;
  final bool isText;
  final double? emptyIconTop; //图片至顶部距离 默认0 剧中于widget

  const EmptyWidget({
    Key? key,
    this.icon,
    this.text,
    this.textFontSize,
    this.bottomWidget,
    this.emptyIconTop = 0,
    this.isText = true,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: (emptyIconTop == 0
            ? MainAxisAlignment.center
            : MainAxisAlignment.start),
        children: [
          SizedBox(height: emptyIconTop),
          FWAssets.emptyIcon,
          Visibility(
            visible: isText,
            child: Padding(
              padding: const EdgeInsets.fromLTRB(0, 12, 0, 0),
              child: Text(
                text ?? '暂无内容',
                style: TextStyle(
                    color: FWColorPicker.textFFAAAAAA,
                    fontSize: textFontSize ?? 14),
              ),
            ),
          ),
          if (bottomWidget != null) bottomWidget!,
        ],
      ),
    );
  }
}
